<!DOCTYPE html>
<html lang="en">
    <head>
        {include file="public/meta" /}
        {include file="public/link" /}
    </head>
    <body data-type="index" class="theme-white">
        <div class="am-g tpl-g">
            {include file="public/header" /}
            {include file="public/left" /}
            {include file="public/content_top" /}
            <ol class="am-breadcrumb">
                <li><a href="../home/index.html" class="am-icon-home">首页</a></li>
                <li><a href="../agents/index.html">代理管理</a></li>
                <li><a href="#">佣金统计</a></li>
            </ol>
            <div class="widget am-cf">
                <div class="am-form-inline" role="form">
                                        <span>日期范围：</span>
                    <div class="am-form-group ">
                        <input type="text" class="am-form-field am-input-sm" name="start" placeholder="请选择起始日期"
                               data-am-datepicker onfocus="this.blur()" value="{$arr.start_query}"/>
                    </div>
                    <div class="am-form-group ">
                        <input type="text" class="am-form-field am-input-sm" name="end" placeholder="请选择结束日期" data-am-datepicker onfocus="this.blur()" value="{$arr.end_query}"/>
                    </div>
                    <button type="button" class="am-btn am-btn-primary am-btn-sm" onclick="info_query()">查询</button>
                    <button type="button" class="am-btn am-btn-warning am-btn-sm" onclick="clear_query()">清除查询</button>
                </div>
                <hr data-am-widget="divider" class="am-divider am-divider-default"/>
                <div class="widget-body widget-body-lg am-fr">
                    <div class="am-scrollable-horizontal">
                        <table class="{$table}">
                            <thead>
                                <tr>
                                    <th>代理(员工)编号</th>
                                    <th>名称</th>
                                    <th>手机号</th>
                                    <th>级别</th>
                                    <th>上级代理ID</th>
                                    <th>收益金额</th>
                                    <th>保证金</th>
                                    <th>账户余额</th>
                                    <th>已提现余额</th>
                                </tr>
                            </thead>
                            <tbody id="list">
                                {volist name="list" id="vo" empty="$empty"}
                                <tr>
                                    <td>{$vo.number}</td>
                                    <td>{$vo.real_name}</td>
                                    <td>{$vo.phone}</td>
                                    {if condition="$vo.grade eq 0"}
                                    <td>员工</td>
                                    {else/}
                                    <td>{$vo.grade}</td>
                                    {/if}
                                    {if condition="$vo.agent eq 0"}
                                    <td>无上级</td>
                                    {else/}
                                    <td>{$vo.agent}</td>
                                    {/if}
                                    <td>{$vo.account}</td>
                                    <td>{$vo.bond}</td>
                                    <td>{$vo.total}</td>
                                    <td>{$vo.wit_total}</td>
                                </tr>
                                {/volist}
                            </tbody>
                        </table>
                        <div class="am-pagination-left">{$page}</div>
                    </div>
                </div>
            </div>
        </div>
        {include file="public/foot" /}
        <script type="text/javascript">
            function del() {
                if (confirm("确定要删除吗？")) {
                    return true;
                } else {
                    return false;
                }
            }
            function edit(obj, id) {
                layer.confirm('确认要通过审核吗？', function (index) {
                    $.ajax({
                        type: 'POST',
                        url: "{:url('index/Agents/pass')}",
                        data: {id: id, edit_type: 1},
                        dataType: 'json',
                        success: function (data) {
                            layer.msg('审核成功!', {icon: 1, time: 1000});
                            window.location.href = "{:url('index/Agents/withdraw')}";
                        },
                        error: function (data) {
                            layer.msg('审核失败!', {icon: 0, time: 1000});
                        },
                    });
                });
            }
            function put(obj, id) {
                layer.confirm('确认要驳回吗？', function (index) {
                    $.ajax({
                        type: 'POST',
                        url: "{:url('index/Agents/pass')}",
                        data: {id: id, edit_type: 0},
                        dataType: 'json',
                        success: function (data) {
                            layer.msg('已驳回!', {icon: 1, time: 1000});
                            window.location.href = "{:url('index/Agents/withdraw')}";
                        },
                        error: function (data) {
                            layer.msg('驳回失败!', {icon: 0, time: 1000});
                        },
                    });
                });
            }
    $(function () {
        var nav = $('.left-sidebar li.sidebar-nav-link');
        nav.removeClass("active");
        nav.eq({$a}).find('ul').show();
        nav.eq({$a}).find('ul li').eq({$b}).find('a').addClass('active');
    });
            function info_query() {
                info();
                $("#form").submit();
            }
            function info() {
                $("input[name='start_query']").val($("input[name='start']").val());
                $("input[name='end_query']").val($("input[name='end']").val());
                $("input[name='phone']").val($("#phone").val());
                        $("input[name='number']").val($("#number").val());
                $("input[name='status']").val($("select[name='status']").val());
            }
            function clear_query() {
                $("input[name='start_query']").val();
                $("input[name='end_query']").val();
                $("select[name='status']").val(-1);
                $("input[name='phone']").val();
                $("input[name='number']").val();
                $("#form").submit();
            }
        </script>
    </body>
</html>